﻿function CheckValue()
{
    obj = document.getElementById("rblReportType");
    var content = document.getElementById("txtContent");
    var rbls = obj.getElementsByTagName('input');
    var j = 0;
    var reporttypeid = 0;
    for (var i = 0; i < rbls.length; i++)
    {
        if (rbls[i].type == 'radio')
        {
            if (rbls[i].checked)
            {
                reporttypeid = rbls[i].value;
                j++;
                if (i == 2)
                {
                    if (content.value.length == 0)
                    {
                        alert('请输入重复的URL地址');
                        return false;
                    }
                }
            }
        }
    }
    if (j == 0)
    {
        alert("请选择举报类型！");
        obj.focus();
        return false;
    }
    else
    {
        var blogid = document.getElementById("hidblogid");
        var bloguserid = document.getElementById("hidbloguserid");
        //var reporttypeid = obj.value;

        $.ajax({
            type: "GET",
            cache: false,
            url: '../ajax/Report.aspx',
            data: ({ blogid: blogid.value, bloguserid: bloguserid.value, reporttypeid: reporttypeid, content: content.value, code: Math.random() }),
            dataType: 'html',
            success: function (obj)
            {
                if (obj == '1')
                {
                    alert("举报成功");
                    window.close();	
                    return false;
                }
                alert('举报失败');
                return false;

            }
        });
    }
}


function blogreport(blogid, youbloguserid)
{
    var rand = Math.random();
    showModalDialog('../Blogs/BlogReportDetail.aspx?blogid=' + blogid + '&bloguserid=' + youbloguserid + '&rand=' + rand, window, 'dialogWidth:580px; dialogHeight:350px;help:0;status:0;resizeable:0;');
}